package com.baidu.ueditor.util;

import org.springframework.boot.system.ApplicationHome;
import org.springframework.core.env.Environment;
import org.sunshine.ueditor.config.UEditorConfig;

public class UploadBasePathUtil {

	public static String findUploadBasePath(Environment env) {
		String basePath =env.getProperty("ueditor.upload-path");
		if(null == basePath || "".equals(basePath)){
			ApplicationHome applicationHome = new ApplicationHome(UploadBasePathUtil.class);
			String ah = applicationHome.getDir().toString();
			basePath = ah + "/upload/";
		}
		if(!basePath.endsWith("/")){
			basePath += "/";
		}
		return basePath;
	}
}
